package com.gzrhhscd.filter;
import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;

import java.io.IOException;

//@WebFilter(urlPatterns = "/*") //lack of *
public class DemonFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
//        Filter.super.init(filterConfig);
        System.out.println("init methods carried on");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("Demo放行前逻辑执行了");
        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("Demo放行后逻辑执行了");
    }

    @Override
    public void destroy() {
//        Filter.super.destroy();
        System.out.println("destroy carried on");
    }
}
